"""
This script will create cluster statistics for a full classification of user vectors, over several models and work types

Ie this is a macro for running clusterAggregate.py and clusterBreakdown.py
"""

import os 
import sys
import datetime
import subprocess

inputdir = sys.argv[1]
aggregatedir = sys.argv[2]
breakdowndir = sys.argv[3]

startmodel = int(sys.argv[4])
endmodel = int(sys.argv[5])

models = range(startmodel, endmodel + 1)
types = ['edits', 'bytes', 'hours']

for model in models:
	for work in types:
		datadir = inputdir + '/model' + str(model) + '/' + work
		aggstatdir = aggregatedir + '/model' + str(model) + '/' + work
		breakstatdir = breakdowndir + '/model' + str(model) + '/' + work

		print datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S') + " Running statistics on model " + str(model) + " " + work + " from " + datadir + " to " + aggstatdir + " and " + breakstatdir

		subprocess.call(['python', 'clusterAggregate.py', datadir, aggstatdir, str(model)])
		subprocess.call(['python', 'clusterBreakdown.py', datadir, breakstatdir, str(model)])

                print datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S') + " Finished running statistics on model " + str(model) + " " + work + " from " + datadir + " to " + aggstatdir + " and " + breakstatdir
		

